#include <iostream>
#include <algorithm>

using namespace std;

const int N = 1e3 + 10, M = 1e4 + 10;

int p[N], n, m, k, res;

struct Node
{
	int a, b, w;
	bool operator< (const Node &t)
	{
		return w < t.w;
	}
}edge[M];

void init()
{
	for (int i = 1; i <= n; i ++ ) p[i] = i;
}

int find(int x)
{
	if (p[x] != x) return p[x] = find(p[x]);
	return p[x];
}

bool kruskal()
{
	sort(edge, edge + m);
	for (int i = 0; i < m; i ++ )
	{
		
		auto e = edge[i];
		int a = e.a, b = e.b, w = e.w;
		
		int pa = find(a), pb = find(b);
		
		if (pa == pb) continue;
		
		p[pa] = pb;
		res += w;
		n -- ;
		if (n == k) return true;	
	}
	
	return false;
}

int main()
{
	cin >> n >> m >> k;
	
	init();
			
	for (int i = 0; i < m; i ++ )
	{
		cin >> edge[i].a >> edge[i].b >> edge[i].w;
	}

	
	if(!kruskal()) puts("No Answer");
	else cout << res << endl;

	return 0;
	

}